package com.atguigu.common.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * @author JOE
 * @date 2020/6/30 17:04
 * @description
 */

public class ProductConstant {

    public static Map<String, AttrType> attrTypeMap = new HashMap<>();


    static {
        attrTypeMap.put(AttrType.ATTR_TYPE_BASE.getDesc(), AttrType.ATTR_TYPE_BASE);
        attrTypeMap.put(AttrType.ATTR_TYPE_SALE.getDesc(), AttrType.ATTR_TYPE_SALE);
    }

    public static Integer getTypeCode(String type) {
        return attrTypeMap.get(type).getCode();
    }

    public enum AttrType {
        ATTR_TYPE_SALE(0,"sale"),
        ATTR_TYPE_BASE(1, "base");

        private Integer code;
        private String desc;

        AttrType(int code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public Integer getCode() {
            return code;
        }
        public String getDesc() {
            return desc;
        }

    }
}
